package pickbook.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import pickbook.model.BuyBookService;
import pickbook.model.SaleBookService;

//전체 도서 관련 컨트롤러 정의
@Controller
public class BookController {

	@Resource(name = "buyBookServiceImpl")
	private BuyBookService buyBookService;

	@Resource(name = "saleBookServiceImpl")
	private SaleBookService saleBookService;

	/**
	 * method : getRecentBookList
	 * comment : 최신판매도서 & 최신희망도서 리스트를 전달하는 메서드
	 * 
	 * @param pageNo
	 * @return
	 * 
	 * @author 제형규, 이형철
	 * @date 2014-07-02
	 */
	@RequestMapping("/book_recent_list.do")
	public ModelAndView getRecentBookList(String pageNo) {
		
		ModelAndView mv = new ModelAndView();
		
		mv.addObject("buybooklvo", buyBookService.getRecentBookList(pageNo));//ModeAndView에 최근 판매도서 목록
		mv.addObject("salebooklvo", saleBookService.getRecentBookList(pageNo));//ModeAndView에 최근 희망도서 목록
		mv.setViewName("book.recent/list");
		
		return mv;
		
	}
}
